<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateFlashSalesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('flash_sales', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->bigInteger('product_id')->comment('商品id');
            $table->string('product_name',255)->comment('商品名称');
            $table->decimal('old_price',10,2)->comment("原价");
            $table->decimal('show_price',10,2)->comment("展示价格");
            $table->integer('stock')->comment("库存");
            $table->timestamp('begin_time')->comment("活动开始时间");
            $table->timestamp('deadline')->comment("活动截止时间");
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('flash_sales');
    }
}
